/*
time:20201016 22:20 PM
key:1.本题最后以一个"随机"负整数表示结尾。
	2.后面那些堆栈溢出问题可能是非递归实现的链表才可以吧。
*/
#include <math.h>
#include <iostream>
#include<string>

using namespace std;

class Node
{
public:
	int data;
	Node* next;
};
void write(Node* head, long long&count)
{
	if (head != NULL) 
	{
		int n;
		cin >> n;
		head->data = n;
		count++;
		if (n >=0)
		{
			head->next = new Node;
			write(head->next, count);
		}
	}
	
}
void read(Node* head, long long&k)
{

		if (head->data >=0)
		{
			k--;
			if (k == 0)
			{
				cout << head->data;
			}
			read(head->next, k);
		}
		
}
int main()
{
	long long k, n, count;
	cin >> k;
	Node* head = new Node;
	count = 0;
	write(head,count);

	long long real_k = (count - k);
	if (real_k < 1||k<1) 
	{

		cout<<"NULL";
	}
	else {
		read(head, real_k);
	}
}

	



